home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 8 / Amoszine 8 (Disk 2 of 3).adf / BELL.lha / bellv1x.amos / bellv1x.amosSourceCode < prev   
AMOS Source Code  |  1992-03-06  |  7KB  |  400 lines

  1. '============================================= 
  2. '
  3. 'BELL V1.x Started 27th June 1995 Midnight   
  4. '
  5. 'Beginners Easy Learning Language. 
  6. '
  7. '============================================= 
  8. Screen Open 0,640,250,8,Hires
  9.  
  10. '----------------------------------------------- 
  11. 'how many bell instructions currently supported  
  12. '----------------------------------------------- 
  13. ROUTINES=25
  14.  
  15.  
  16. Dim LISTING$(100) : Rem allowable lines of code in ascii script
  17.  
  18. Global LISTING$(),GC$,SPV$,AA,SPEED$,TIMES$,REP
  19.  
  20. RR:
  21. REP=0
  22.  
  23. '------------------------------------------
  24. 'read in script, program.bell, into script$  
  25. '------------------------------------------  
  26. Open In 1,"DF0:program.bell"
  27. L=Lof(1)
  28. Close 1
  29. Reserve As Data 6,L
  30. Bload "DF0:program.Bell",6
  31. ST6=Start(6) : E6=ST6+Length(6)
  32. SCRIPT$=Peek$(ST6,L)
  33.  
  34.  
  35. '------------------------------------------
  36. 'put the script instructions in Listing$()   
  37. '------------------------------------------
  38. LAST10=0 : COUNT=1
  39. For A=1 To L
  40. G$=Mid$(SCRIPT$,A,1)
  41. If G$=Chr$(10)
  42. CHARS=A-1-LAST10
  43. LISTING$(COUNT)=Mid$(SCRIPT$,LAST10+1,CHARS)
  44. LAST10=A
  45. 'Print LISTING$(COUNT) 
  46. Inc COUNT
  47. End If 
  48.  
  49. Next A
  50.  
  51.  
  52.  
  53. '------------------
  54. 'execute the script
  55. '------------------
  56. For AA=1 To COUNT-1
  57.     GC$=LISTING$(AA)
  58.    _SETUP
  59. Next AA
  60. If REP=1 Then Goto RR
  61.  
  62.  
  63. '------------------------------------
  64. 'this calls the instructions according to  
  65. 'commands passed to it in gc$
  66. '------------------------------------
  67. Procedure _SETUP
  68. 'Home : Print GC$
  69.  
  70.  
  71. GC$=Upper$(GC$)
  72.  
  73. If Left$(GC$,9)="SHOW ANIM"
  74.     L=Len(GC$)
  75.     TIMES$=Right$(GC$,2)-" "
  76.     SPV$=Mid$(GC$,11,L)
  77.     S$=Right$(SPV$,2)
  78.     SPV$=SPV$-S$
  79.     SPV$=SPV$-" "
  80.    _SHOWANIM
  81.    Pop Proc
  82. End If 
  83.  
  84. If Left$(GC$,7)="MESSAGE"
  85.     Inc AA
  86.     GC$=LISTING$(AA)
  87.     SPV$=GC$
  88.    _MESSAGE
  89.    Pop Proc
  90. End If 
  91.  
  92. If Left$(GC$,8)="SHOW DOC"
  93.     SPV$=Right$(GC$,1)
  94.    _SHOWDOC
  95.    Pop Proc
  96. End If 
  97.  
  98. If Left$(GC$,2)="VT"
  99.     SPV$=Right$(GC$,1)
  100.    _VT
  101.    Pop Proc
  102. End If 
  103.  
  104. If Left$(GC$,14)="NO DRIVE CLICK"
  105.    _CLICKNOT
  106.    Pop Proc
  107. End If 
  108.  
  109. If Left$(GC$,8)="SHOW PIC"
  110.     SPV$=Right$(GC$,1)
  111.    _SHOWPIC
  112.    Pop Proc
  113. End If 
  114.  
  115. If Left$(GC$,12)="CLEAR SCREEN"
  116.     SPV$=Right$(GC$,1)
  117.    _CLEARSCREEN
  118.    Pop Proc
  119. End If 
  120.  
  121. If Left$(GC$,10)="WAIT MOUSE"
  122.    _WAITMOUSE
  123.    Pop Proc
  124. End If 
  125. If Left$(GC$,8)="WAIT KEY"
  126.    _WAITKEY
  127.    Pop Proc
  128. End If 
  129.  
  130. If Left$(GC$,5)="PAUSE"
  131.     L=Len(GC$)
  132.     SPV$=Mid$(GC$,6,L)
  133.     SPV$=SPV$-" "
  134.    _PAUSE
  135.    Pop Proc
  136. End If 
  137.  
  138. If Left$(GC$,11)="PLAY SAMPLE"
  139.     L=Len(GC$)
  140.     SPEED$=Right$(GC$,2)-" "
  141.     SPV$=Mid$(GC$,13,L)
  142.     S$=Right$(SPV$,2)
  143.     SPV$=SPV$-S$
  144.     SPV$=SPV$-" "
  145.    _PLAYSAM
  146.    Pop Proc
  147. End If 
  148.  
  149. If Left$(GC$,10)="PLAY MUSIC"
  150.     SPV$=Right$(GC$,1)
  151.    _PLAYMUSIC
  152.    Pop Proc
  153. End If 
  154.  
  155. If Left$(GC$,10)="STOP MUSIC"
  156.    _STOPMUSIC
  157.    Pop Proc
  158. End If 
  159.  
  160. If Left$(GC$,11)="FADE SCREEN"
  161.     SPV$=Right$(GC$,1)
  162.    _FADESCREEN
  163.    Pop Proc
  164. End If 
  165.  
  166. If Left$(GC$,10)="APPEAR PIC"
  167.     SPV$=Right$(GC$,1)
  168.    _APPEAR
  169.    Pop Proc
  170. End If 
  171.  
  172. If Left$(GC$,11)="SQUARE WIPE"
  173.    _SQUAREWIPE
  174.    Pop Proc
  175. End If 
  176.  
  177. If Left$(GC$,11)="WAVE WIPE"
  178.    _WAVEWIPE
  179.    Pop Proc
  180. End If 
  181.  
  182. If Left$(GC$,9)="SCROLL DOWN"
  183.    _SCROLLDOWN
  184.    Pop Proc
  185. End If 
  186.  
  187. If Left$(GC$,10)="WHITE WIPE"
  188.    _WHITEWIPE
  189.    Pop Proc
  190. End If 
  191.  
  192. If Left$(GC$,8)="MOUSE ON"
  193.    _MOUSEON
  194.    Pop Proc
  195. End If 
  196.  
  197. If Left$(GC$,9)="MOUSE OFF"
  198.    _MOUSEOFF
  199.    Pop Proc
  200. End If 
  201.  
  202. If Left$(GC$,9)="CROSSHAIR"
  203.    _CROSSHAIR
  204.    Pop Proc
  205. End If 
  206.  
  207. If Left$(GC$,9)="CLOCK"
  208.    _CLOCK
  209.    Pop Proc
  210. End If 
  211.  
  212. If Left$(GC$,9)="POINTER"
  213.    _POINTER
  214.    Pop Proc
  215. End If 
  216.  
  217. If Left$(GC$,6)="REPEAT"
  218.    REP=1
  219.    Pop Proc
  220. End If 
  221.  
  222. If Left$(GC$,3)="END"
  223.    _END
  224.    Pop Proc
  225. End If 
  226.  
  227. Print "Error 0: Syntax error in line";AA : Print GC$
  228. Clear Key : Wait Key 
  229. End Proc
  230.  
  231.  
  232. '--------------------- 
  233. 'THE BELL COMMAND SET
  234. '--------------------- 
  235. Procedure _SHOWANIM
  236. LP$="df0:Anims/Anim"+SPV$
  237. S=Val(TIMES$)
  238. Iff Anim LP$ To 0,S
  239. End Proc
  240. Procedure _VT
  241. 'not working proply atmo 
  242.  
  243. If Exist("df0:u/VT")
  244. Amos To Back 
  245. Exec "df0:U/VT df0:pictures/pic"+SPV$
  246. Amos To Front 
  247. Wait 50
  248. End If 
  249. End Proc
  250.  
  251.  
  252. Procedure _SHOWPIC
  253. LP$="df0:pictures/pic"+SPV$
  254. Trap Load Iff LP$,0
  255.  
  256. If Errtrap
  257. 'its an error so must be abk pic 
  258. Load LP$,10
  259. Unpack 10 To 0
  260. Erase 10
  261. End If 
  262. End Proc
  263.  
  264. Procedure _CLEARSCREEN
  265. CLR=Val(SPV$)
  266. Flash Off : Curs Off 
  267. Paper CLR : Cls CLR
  268. End Proc
  269. Procedure _WAITMOUSE
  270. While Mouse Key=0 : Wend 
  271. End Proc
  272. Procedure _WAITKEY
  273. 'Home : Paper 0 : Pen 1 : Print "Press any key.."
  274. K$="" : While K$="" : K$=Inkey$ : Wend 
  275. End Proc
  276. Procedure _PAUSE
  277. Wait Val(SPV$)*50
  278. End Proc
  279. Procedure _PLAYSAM
  280. Erase 4
  281. LP$="df0:Samples/sam"+SPV$
  282. Open In 1,LP$
  283. Reserve As Work 4,Lof(1)
  284. Bload LP$,4
  285. S=Val(SPEED$)
  286. Sam Raw 15,Start(4),Length(4),S*1000
  287. Close 1
  288. End Proc
  289.  
  290. Procedure _PLAYMUSIC
  291. LP$="df0:music/music"+SPV$
  292. Track Load LP$,3
  293. Track Play 3
  294. End Proc
  295. Procedure _STOPMUSIC
  296. Track Stop 
  297. Erase 3
  298. End Proc
  299. Procedure _FADESCREEN
  300. F=Val(SPV$)
  301. If F<=0 Then F=1
  302. Fade F
  303. Wait F*7
  304. End Proc
  305. Procedure _APPEAR
  306.  
  307. LP$="df0:pictures/pic"+SPV$
  308. Load Iff LP$,0
  309.  
  310. 'fades in a picture, on current screen.  
  311.  
  312. Dim C(15)
  313. Screen Hide 
  314. For N=0 To 15
  315. C(N)=Colour(N) : Colour N,0
  316. Next 
  317. Screen Show : Wait Vbl 
  318. Fade 1,C(0),C(1),C(2),C(3),C(4),C(5),C(6),C(7),C(8),C(9),C(10),C(11),C(12),C(13),C(14),C(15)
  319. Wait 15
  320.  
  321. End Proc
  322. Procedure _SQUAREWIPE
  323. If Screen Width=640
  324. Cls 0 : Locate 0,22
  325. Print "ERROR 1: SQUARE WIPE ONLY WORKS FOR LOW RES PICS (320 WIDTH) Press a key" : Wait Key : Pop Proc
  326. End If 
  327. X1=159 : Y1=127 : X2=160 : Y2=128
  328. Ink 0
  329. For A=1 To 160
  330. Bar X1,Y1 To X2,Y2
  331. Inc X2 : Inc Y2 : Dec X1 : Dec Y1
  332. Next A
  333. End Proc
  334. Procedure _WAVEWIPE
  335. If Screen Width=640
  336. Cls 0 : Locate 0,22
  337. Print "ERROR 2: WAVE WIPE ONLY WORKS FOR LOW RES PICS (320 WIDTH) Press a key" : Wait Key : Pop Proc
  338. End If 
  339. Ink 0
  340. For X=0 To 319 : Draw 0,255 To X,0 : Next 
  341. For Y=1 To 255 : Draw 0,255 To 319,Y : Next 
  342. End Proc
  343. Procedure _SCROLLDOWN
  344. For Y=50 To 320
  345. Screen Display 0,128,Y,,
  346. Wait Vbl 
  347. Next Y
  348. End Proc
  349. Procedure _WHITEWIPE
  350. For A=0 To 15
  351. Colour A,$FFF
  352. Wait Vbl 
  353. Next A
  354.  
  355. Wait Vbl 
  356. Wait 2
  357. End Proc
  358. Procedure _MOUSEON
  359. Show On 
  360. End Proc
  361. Procedure _MOUSEOFF
  362. Hide 
  363. End Proc
  364. Procedure _SHOWDOC
  365. If Exist("df0:u/ppmore")
  366. Amos To Back 
  367. Exec "df0:U/ppmore df0:docs/doc"+SPV$
  368. Amos To Front 
  369. Wait 50
  370. End If 
  371. End Proc
  372. Procedure _MESSAGE
  373. Paper 0
  374. Centre SPV$
  375. End Proc
  376. Procedure _CROSSHAIR
  377. Change Mouse 2
  378. End Proc
  379. Procedure _POINTER
  380. Change Mouse 1
  381. End Proc
  382. Procedure _CLOCK
  383. Change Mouse 3
  384. End Proc
  385. Procedure _CLICKNOT
  386. If Exist("df0:U/clicknot")
  387. Exec "df0:U/clicknot"
  388. End If 
  389.  
  390. End Proc
  391.  
  392. Procedure _END
  393. Default 
  394. Screen Open 0,640,256,8,Hires
  395. Flash Off : Curs Off : Cls 0
  396. Paper 0 : Pen 6
  397. Locate 0,22 : Print "End of Program:  B.E.L.L V1.0  (C)95 Steve Bye"
  398. Wait 200
  399. Stop 
  400. End Proc